My Useful Scripts

Being an engineer, I like to find the most efficient ways of doing tasks. Having a good knowledge of programming means that a lot of mundane or laborious tasks can be automated with some scripts which, in the ethos of open source, I'm sharing here:

Music Scripts

Since I have my house wired for multimedia, then this requires some media to be present. All of the CDs in the house have been ripped to FLAC so that they can be played at the original 44.1kHz sample rate and 16 bit resolution stereo.

The music lives in my /home/music directory (which just happens to be symbolic linked from $HOME/Music, but that's not important) and within that are directory names like "flac" "mp3-320kbit" "mp3-128kbit" and "mp3-128kbit-resampled"

Underneath these directories, are directories for the artists which contain directories for each album. As I said, most of the music is FLAC, but others may only be in MP3 as that's how they were originally bought or downloaded. Each album directory also contains a "folder.jpg" of the album cover.

Back to the FLAC files - they are really too large for a portable device like a phone or a tablet, so I re-encode them all to MP3 at 128kbit/s and they go into the "mp3-128kbit-resampled" directory.

I also have a directory under $HOME/Music called "highest-quality-links" which contains symbolic links to the highest quality encoding for any particular album that is on the system.

What if you need to add some random tracks to your Car Media Server's Music Player Daemon (MPD)? Look no further!

So, there are several scripts here:

Script Description
check_music_covers.sh
save | view
This script scans the music directory specified underneath /home/music and checks if there is a "folder.jpg" for each album.
flac_downto_128k.sh
save | view
This script scans the entire FLAC directory (or optionally just a particular artist for speed's sake), removes any unwanted filename characters and re-encodes the file to an mp3 at 128kbit/s, saving it in exactly the same directory structure underneath the "mp3-128kbit-resampled" directory.
flac_un_the.sh
save | view
This script scans the entire FLAC directory (or optionally just a particular artist for speed's sake), fixing any missed tags / filenames for artists that end up as "The bla-de-bla" and changes then to "bla-de-bla, The" It also removes any unwanted filename characters.
hq_music_linker.sh
save | view
This script scans the all music directories underneath /home/music and creates a symbolic link of the album to the highest quality. This is useful for pointing music servers at a single directory. It assumes that there isn't actually any duplicated albums of differing quality of course!
magic_button.sh
save | view
This script is for the Car Media Server v2.0 and will allow a single button on the car's dashboard to skip / replay tracks or even reboot the server.
mpd_lcd.py
save | view
This script will fetch the currently playing track from a Music Player Daemon and display the artist, album, and track on a 20x4 LCD. This is described here: MPD Monitor
mpd_track_list.sh
save | view
This script will pick music from an active MPD server from an allowed set of genres. It will then remove any unwanted artists / albums or song titles. The list will be used by "random_mpd_tracks.sh" to select random tracks from.
random_mpd_tracks.sh
save | view
This script will add random tracks to a Music Player Daemon to ensure that the music never stops! The random tracks are picked from the liste created by "mpd_track_list.sh".




Del.ico.us Digg Facebook Google LinkedIn LiveJournal NewsVine reddit StumbleUpon Twitter
Valid XHTML 1.0 Transitional Valid CSS! [Valid Atom 1.0] [Valid RSS 2.0]
[ Page last updated Tue 13th Feb 2024 | viewed 64 times ]